<template>
  <div>
    <div>
      <div>
        <el-collapse v-model="activeNames" @change="handleChange">
          <el-collapse-item title="筛选" name="1">
            <div class="demo-input-suffix">
              操作日期：
              <el-date-picker
                v-model="value"
                type="date"
                placeholder="选择日期"
              >
              </el-date-picker>
              操作人员
              <el-select v-model="opt" placeholder="请选择">
                <el-option
                  v-for="item in opt"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>

            <el-button type="primary" @click="onSubmit">立即查询</el-button>
          </el-collapse-item>
        </el-collapse>
      </div>
      <div>
        <!-- <el-button type="buttun" size="primary" button-position="right" @click="dialogVisible = true">添加</el-button> -->
        清除日志:
         <el-date-picker
                v-model="value"
                type="date"
                placeholder="选择清除的日期"
              >
              </el-date-picker>
        <el-button type="button" @click="remove(index)">确定</el-button>
        
      </div>
    </div>
    <div>
      <el-table :data="tableData" border style="width: 100%" id="warehouse">
        <el-table-column fixed prop="id" label="编号" width="200">
        </el-table-column>
        <el-table-column prop="master" label="操作者" width="200">
        </el-table-column>
        <el-table-column prop="dotime" label="操作日期" width="300">
        </el-table-column>
        <el-table-column prop="ip" label="IP地址" width="250">
        </el-table-column>
        <el-table-column prop="record" label="操作记录" width="353">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 部门信息列表
      tableData: [
        {
          id: "87386",
          master: "",
          dotime: "",
          ip: "121324553",
          record: ok,
        },
      ],
      options: [
        {
          value: "",
          label: "",
        },
      ],
      // 弹窗显示控制属性
      dialogVisible: false,
      value: true,
      input1: "",
      input2: "",
      input3: "",
      input4: "",
      // 部门信息
      warehouse: {
        id: "",
        waster: "",
        dotime: "",
        ip: "20",
        record: 1,
      },
    };
  },
  methods: {
    handleClick(row) {
      console.log(row);
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    onSubmit() {
      let dt = new Date();
      var y = dt.getFullYear();
      var mt = (dt.getMonth() + 1).toString().padStart(2, "0");
      var day = dt.getDate().toString().padStart(2, "0");
      var h = dt.getHours().toString().padStart(2, "0");
      var m = dt.getMinutes().toString().padStart(2, "0");
      this.warehouse.addtime = y + "-" + mt + "-" + day + " " + h + ":" + m;
      console.log("此刻时间", this.warehouse.addtime);
      console.log("部门", this.warehouse);
      console.log("提交!");
      this.$refs.form.validate(async (valid) => {
        if (valid) {
          // 发起真正的提交
          const { data: res } = await this.$http.post(
            "dept/addDept",
            this.dept
          );
          console.log("shanchu" + res.data);
          // if (res.data != "success") {
          //   this.$message.error("修改失败");
          // } else {
          //   //隐藏添加对话框
          //   this.editDialogVisible = false;
          //   this.initCollevtionList();
          //   this.$message.success("修改成功");
          // }
        }
      });
    },
    remove(index) {},
    changeStatus(e, row, index) {
      // console.log(e, row, index); //e返回状态，row当前行数据，index下标
    },
  },
};
</script>